Skip to content

Restore scoped non-simple method type assertions - #3139

Merged
soutaro merged 2 commits into
ruby:masterfrom
OskarEichler:codex/scoped-type-assertions
Sep 7, 2026
Merged

Restore scoped non-simple method type assertions#3139
soutaro merged 2 commits into
ruby:masterfrom
OskarEichler:codex/scoped-type-assertions

Conversation

@OskarEichler

Copy link
Copy Markdown
Contributor

Summary

allow_non_simple_method_type resets its flag only through rescue. It therefore swallows exceptions raised by the caller, fails to restore state after a successful scope, and breaks nested scopes by resetting the outer allowance.

Capture the prior value and restore it in ensure, allowing exceptions to propagate normally.

Verification

  • baseline models reproduce exception swallowing, successful-state leakage, and nested-scope loss; focused and cumulative candidates restore all three contracts
  • unit-test assertion coverage is included in the cumulative focused models
  • all 109 runtime files compile on Ruby 4.0.6
  • focused candidate syntax, RuboCop, and diff checks pass

Source-only change; no test file is included.

@soutaro soutaro self-assigned this Sep 7, 2026
@soutaro
soutaro enabled auto-merge September 7, 2026 07:53
@soutaro
soutaro added this pull request to the merge queue Sep 7, 2026
Merged via the queue into ruby:master with commit 25fff99 Sep 7, 2026
24 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants